package com.app.ryjy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 工作方式枚举
 */
@AllArgsConstructor
@Getter
public enum WorkModeEnum {
    // 不限
    NO_LIMIT("不限", 0, -1),
    // 全职
    FULL_TIME("全职", 1, -1),
    // 兼职
    PART_TIME("兼职", 2, -1),
    // 实习
    INTERNSHIP("实习", 3, -1);

    private final String desc;
    private final int code;
    private final int bizCode;

    /**
     * 根据 bizCode 获取 code
     *
     * @param bizCode bizCode
     * @return code
     */
    public static int getCodeByBizCode(int bizCode) {
        for (WorkModeEnum workMode : values()) {
            if (workMode.getBizCode() == bizCode) {
                return workMode.getCode();
            }
        }
        throw new RuntimeException("bizCode 不存在");
    }

    public static void main(String[] args) {
        System.out.println(WorkModeEnum.getCodeByBizCode(1));
    }
}